package com.cmo.common.controller.triage;

import java.util.HashMap;
import java.util.Map;

import com.cmo.common.model.Triage;
import com.cmo.common.utils.Shared;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Record;

public class TriageController extends Controller {

	Triage service=new Triage();
	Shared shared=new Shared();
	/**
	 * 
	* @Title: findByTriageName 
	* @Description: 根据登陆ip查询当前分诊台的名称
	* @param     设定文件 
	* @return void    返回类型 
	* @throws
	 */
	public void findByTriageName(){

		Map<String, Object> map=new HashMap<String, Object>();
		Object ip=shared.getIpAddr(getRequest());
		if(null==ip){
			map.put("return_msg","获取ip失败");
			map.put("return_code","fail");
			renderJson(map);
			return;
		}
		Record record=service.findByTriageName(ip);
		if(null==record){
			map.put("return_msg","获取分诊台名称失败");
			map.put("return_code","fail");
			renderJson(map);
			return;
		}else{
			map.put("count",record.get("count"));
			map.put("return_code","success");
			map.put("return_msg",record.get("name"));
			renderJson(map);
		}
		renderJson(map);
	}
	
}
